package testgrails

//C-2: Email address must be a unique field (integration test)

import static org.junit.Assert.*
import org.junit.*

class CustomerIntegrationTests {
	def customer
    @Before
    void setUp() {
        customer = new Customer( emailAddress: 'bushrat@gmail.com', password: 'password', dateCreated: new Date(), lastUpdated: new Date() )
    }

    @After
    void tearDown() {
        // Tear down logic here
    }
	
	
	//C-2: Email address must be a unique field (integration test)
    @Test
    void testUniqueEmailAddress() {
	   customer.save(flush:true)
	   assertNotNull( customer.findAll(emailAddress: 'bushrat@gmail.com'))
       def customer2 = new Customer( emailAddress: 'bushrat@gmail.com', password: 'password', dateCreated: new Date(), lastUpdated: new Date() )
	   assertNull(customer2.save(flush:true))
	   }
}
